//
//  ZYNCollectionViewCellForHotListMore.m
//  VideoPic
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ZYNCollectionViewCellForHotListMore.h"
#import "ZYNModelForMoreHotSongList.h"
#import <YYWebImage.h>
@interface ZYNCollectionViewCellForHotListMore ()
@property (nonatomic, strong) UIImageView *imageForPic;
@property (nonatomic, strong) UILabel *labelForContent;
@property (nonatomic, strong) UILabel *labelForListenCount;
@property (nonatomic, strong) UIImageView *imageForTing;

@end
@implementation ZYNCollectionViewCellForHotListMore

#pragma mark - init
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

#pragma mark - createSubViews
- (void)createSubViews {
    self.imageForPic = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageForPic];
    self.imageForPic.backgroundColor = [UIColor lightGrayColor];
    
    self.labelForContent = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForContent];
    
    self.imageForTing = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageForTing];
    
    self.labelForListenCount = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForListenCount];

    
}

#pragma mark - layout
- (void)layoutSubviews {
    [super layoutSubviews];
    self.imageForPic.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 40);
    self.labelForContent.frame= CGRectMake(0, SCREEN_HEIGHT - 30, SCREEN_WIDTH, 30);
    self.labelForContent.backgroundColor = [UIColor cyanColor];
    
    self.imageForTing.frame = CGRectMake(SCREEN_WIDTH / 3 * 2, 5, SCREEN_WIDTH / 8, SCREEN_WIDTH / 8);
    self.imageForPic.frame = CGRectMake(0, 0, WIDTH, HEIGHT - 40);
    self.labelForContent.frame= CGRectMake(0, HEIGHT - 30, WIDTH, 30);
    self.labelForContent.font = [UIFont systemFontOfSize:14];
    self.imageForTing.frame = CGRectMake(WIDTH / 3 * 2, 5, WIDTH / 8, WIDTH / 8);
    self.imageForTing.image = [UIImage imageNamed:@"Ting"];
    
    self.labelForListenCount.frame = CGRectMake(SCREEN_WIDTH - 30, 0, SCREEN_WIDTH / 6, SCREEN_WIDTH / 4);

}

#pragma mark - deliverModel
- (void)passModel:(ZYNModelForMoreHotSongList *)model {
    self.imageForPic.yy_imageURL = [NSURL URLWithString:model.pic_url];
    self.labelForContent.text = model.title;
    
//    CGFloat count = model.listen_count;
    CGFloat count = model.listen_count;
    self.labelForListenCount.text = [NSString stringWithFormat:@"%.f万", count / 10000];
    self.labelForListenCount.font = [UIFont systemFontOfSize:12];
    self.labelForListenCount.textColor = [UIColor whiteColor];
    
}
@end
